package com.core.cloudbusiness.sheet.process.controller;

import com.core.cloudbusiness.sheet.process.service.CloudSheetProcessService;
import com.core.cloudcommon.CommonResult;
import com.core.cloundbusinessapi.sheet.process.dto.CloudSheetNotSignForDTO;
import com.core.cloundbusinessapi.sheet.process.dto.CloudSheetProcessDTO;
import com.core.cloundbusinessapi.sheet.process.vo.CloudSheetProcessVO;
import com.core.cloundbusinessapi.sheet.process.vo.CloudSheetSignForVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author =====Lqj=====
 * @className CloudSheetProcessController
 * @description 工单流程控制接口
 * @create 2024/11/28 15:05
 **/
@RestController
@RequestMapping("/cloud/sheet/process")
public class CloudSheetProcessController {

    @Autowired
    private CloudSheetProcessService cloudSheetProcessService;

    @PostMapping("/task")
    public CommonResult<CloudSheetProcessDTO> task(@Validated @RequestBody CloudSheetProcessVO cloudSheetProcessVO) {
        CloudSheetProcessDTO task = cloudSheetProcessService.task(cloudSheetProcessVO);
        return CommonResult.OK(task);

    }

    @PostMapping("/sign")
    public CommonResult<String> sign(@Validated @RequestBody CloudSheetSignForVO cloudSheetSignForVO) {
        return CommonResult.OK(cloudSheetProcessService.signFor(cloudSheetSignForVO.getSheetCode()));
    }

    @GetMapping("/notSignFor")
    public CommonResult<List<CloudSheetNotSignForDTO>> notSignFor() {
        return CommonResult.OK(cloudSheetProcessService.sheetNotSignFor());
    }
}
